package com.itheima.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAspect {

    @Pointcut("execution(void com.itheima.dao.BookDao.update())")
    public void pt(){}

//    @Before("pt()")
//    public void before() {
//        System.out.println("before advice...");
//    }

    @After("pt()")
    public void after() {
        System.out.println("after advice...");
    }

    @Around("pt()")
    public void around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("around before advice...");

        joinPoint.proceed();

        System.out.println("around after advice...");
    }
//
//    @AfterReturning("pt()")
//    public void afterReturning() {
//        System.out.println("afterReturning advice...");
//    }
//
//    @AfterThrowing("pt()")
//    public void afterThrowing() {
//        System.out.println("afterThrowing advice...");
//    }

}
